layui.use(['element','layer'],function () {
    var $ = layui.$;
    var layer = layui.layer;
   $(".pay-btn").on('click',function(){
       var channel = $(this).data("channel");
       if(channel == 1){
           location.href = "/settlement/payonline2?channel=1&elderlyId=" + $("#elderlyId").val()+"&curr=" + $("#curr").val()+"&elderlyName=" + $("#elderlyName").val()+"&orgId=" + $("#orgId").val();
       }else if(channel == 2){
           location.href = "/settlement/payonline2?channel=2&elderlyId=" + $("#elderlyId").val()+"&curr=" + $("#curr").val()+"&elderlyName=" + $("#elderlyName").val()+"&orgId=" + $("#orgId").val();
       }else if(channel == 3){
           $.ajax({
               url:'/settlement/wappay',
               data:{elderlyId:$("#elderlyId").val(),channel:channel,curr:$("#curr").val(),orgId:$("#orgId").val(),elderlyName:$("#elderlyName").val()},
               type:'POST',
               dataType:'json',
               success:function(res){
                   if(res.code == 200){
                       location.href = res.data.code_url;
                   }else{
                       layer.msg("服务器繁忙,请联系管理员！");
                   }
               },
               error:function () {
                   layer.msg("服务器繁忙,请联系管理员！");
               }
           });
       }

   });
});